package main

import "fmt"

type Human struct {
	name string
	sex  string
}

func (this *Human) Eat() {
	fmt.Println("Huamn.Eat()....")
}
func (this *Human) Walk() {
	fmt.Println("Huamn.Walk()....")
}

type SuperMan struct {
	Human //SuperMan类继承了Human类
	level int
}

// 重写Eat
func (this *SuperMan) Eat() {
	fmt.Println("SuperMan.Eat()....")
}

// 添加子类的新方法
func (this *SuperMan) Fly() {
	fmt.Println("SuperMan.Fly()....")
}

func main() {
	h := Human{"zhangsan", "female"}
	h.Eat()
	h.Walk()

	superman := SuperMan{h, 1}
	superman.Eat()
	superman.Fly()
}
